Hệ thống xếp lịch học tín chỉ cho sinh viên CNTT trên PHP & MySQL
112.080 lượt xem;
1 <!-- Edit this file to change the layout of the detail view form -->
2
3 <a name="detail-view"></a>
4 <div class="panel-heading"><h3 class="panel-title"><strong><%%DETAIL_VIEW_TITLE%%></strong></h3></div>
5
6 <div class="panel-body" id="departments_dv_container">
7 <!-- child links -->
8 <div class="row vspacer-md">
9 <div class="col-xs-12">
10 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="class_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="class_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Class time table</a>
11 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="class_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_class_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Class time table</a>
12 <input type="hidden" id="class_time_table_hclink" value="class_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
13 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="exam_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="exam_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Exam time table</a>
14 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="exam_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_exam_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Exam time table</a>
15 <input type="hidden" id="exam_time_table_hclink" value="exam_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
16 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="student_details_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="student_details_link"><i class="glyphicon glyphicon-list-alt"></i> Student details</a>
17 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="student_details_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_student_details_link"><i class="glyphicon glyphicon-list-alt"></i> Student details</a>
18 <input type="hidden" id="student_details_hclink" value="student_details_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
19 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="notices_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="notices_link"><i class="glyphicon glyphicon-list-alt"></i> Notices</a>
20 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="notices_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_notices_link"><i class="glyphicon glyphicon-list-alt"></i> Notices</a>
21 <input type="hidden" id="notices_hclink" value="notices_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
22 <div class="clearfix"></div>
23 </div>
24 </div>
25 <hr class="hidden-xs hidden-sm">
26
27 <div class="row">
28 <!-- form inputs -->
29 <div class="col-md-8 col-lg-10" id="departments_dv_form">
30 <fieldset class="form-horizontal">
31
32 <div class="form-group">
33 <hr class="hidden-md hidden-lg">
34 <label for="id" class="control-label col-lg-3">ID</label>
35 <div class="col-lg-9">
36 <div class="form-control-static" id="id"><%%VALUE(id)%%></div>
37 </div>
38 </div>
39
40 <div class="form-group">
41 <hr class="hidden-md hidden-lg">
42 <label for="name" class="control-label col-lg-3">Tên Môn học<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
43 <div class="col-lg-9">
44 <input maxlength="40" type="text" class="form-control" name="name" id="name" value="<%%VALUE(name)%%>" required>
45 </div>
46 </div>
47
48 <div class="form-group">
49 <hr class="hidden-md hidden-lg">
50 <label for="school" class="control-label col-lg-3" data-parent_link="view_parent_modal">Lớp học<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
51 <div class="col-lg-9">
52 <div class="form-control-static" style="white-space: nowrap; overflow-x: hidden;"><%%COMBO(school)%%><%%PLINK(school)%%><%%ADDNEW(schools)%%></div>
53 </div>
54 </div>
55
56 </fieldset>
57 </div>
58
59 <!-- DV action buttons -->
60 <hr class="hidden-md hidden-lg">
61 <div class="col-md-4 col-lg-2" id="departments_dv_action_buttons">
62 <div class="btn-toolbar">
63 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
64 <%%UPDATE_BUTTON%%>
65 </div><p></p>
66 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
67 <%%DESELECT_BUTTON%%>
68 <%%DVPRINT_BUTTON%%>
69 <%%DELETE_BUTTON%%>
70 </div><p></p>
71 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
72 <%%INSERT_BUTTON%%>
73 </div>
74 </div>
75 </div>
76 </div>
77
78
79 <!-- child records -->
80 <hr>
81 <div class="row">
82 <div class="col-lg-10 col-lg-offset-1">
83 <div id="departments-children" class="children-tabs"></div>
84 </div>
85 </div>
86
87 </div><!-- /div class="panel-body" -->
88 <script>
89 $j(function() {
90 var add_new_mode = (!$j('input[name=SelectedID]').val());
91 var embedded_mode = ($j('input[name=Embedded]').val() == 1);
92
93 /* auto-close embedded page? */
94 var autoclose_mode = ($j('input[name=AutoClose]').val() == 1);
95 var record_added_ok = (location.search.split('record-added-ok=').length == 2);
96 var record_updated_ok = (location.search.split('record-updated-ok=').length == 2);
97 if((record_added_ok || record_updated_ok) && embedded_mode && autoclose_mode){
98 setTimeout(AppGini.closeParentModal, 2000);
99 }
100
101 /* enable DV action buttons to float on scrolling down the form */
102 enable_dvab_floating();
103
104 if(!(embedded_mode && AppGini.mobileDevice())){
105 $j('select, input[type=text], textarea').not(':disabled').eq(0).focus();
106 }
107
108 $j('form').eq(0).change(function(){
109 if($j(this).data('already_changed')) return;
110 if($j('#deselect').length) $j('#deselect').removeClass('btn-default').addClass('btn-warning').get(0).lastChild.data = " <%%TRANSLATION(Cancel)%%>";
111 $j(this).data('already_changed', true);
112 });
113
114 $j('a[href="<%%TRANSLATION(ImageFolder)%%>"]').click(function(){ /* */ return false; });
115
116 if(embedded_mode){
117 /* hide links to children tables in embedded mode */
118 $j('.detail_view a[id$=_link]').remove();
119
120 /* append embedded mode to all links */
121 var append_embedded = function(){
122 $j('a[href]:not([href^="#"]):not([href^="javascript"]):not([href$="Embedded=1"]):not([href*="link.php?t="]):not([href^="mailto:"])').each(
123 function(){
124 $j(this).attr('href', $j(this).attr('href') + '&Embedded=1');
125 }
126 );
127 }
128 setTimeout(append_embedded, 500);
129 setTimeout(append_embedded, 1500);
130 setTimeout(append_embedded, 2500);
131 setTimeout(append_embedded, 3500);
132 }
133
134 /* when no record is selected ('add new' mode) */
135 if(add_new_mode){
136 /* hide links to children tables */
137 $j('.detail_view a[id$=_link]').remove();
138 }else{
139 post(
140 'parent-children.php', {
141 ParentTable: 'departments',
142 SelectedID: '<%%VALUE(id)%%>',
143 Operation: 'show-children'
144 },
145 'departments-children'
146 );
147 }
148
149 if(!embedded_mode){
150 /* add a horizontal spacer to [add new parent] buttons that don't have a spacered element before them */
151 $j('.add_new_parent').prev(':not(.hspacer-md)').next().addClass('hspacer-md');
152
153 $j('.add_new_parent').click(function(){
154 var pt = $j(this).attr('id').replace(/_add_new$/, '');
155 modal_window({
156 url: pt + '_view.php?addNew_x=1&Embedded=1',
157 close: function(){
158 var field_id = $j('#' + pt + '_add_new').prevAll('input:hidden').eq(0).attr('id');
159 $j('#' + field_id + '-container').select2('focus').select2('focus');
160 },
161 size: 'full',
162 title: $j(this).attr('title')
163 });
164 });
165 }
166
167 AppGini.hideViewParentLinks();
168
169 $j('form').on('click', '.view_parent', function(){
170 var pt = $j(this).attr('id').replace(/_view_parent$/, '');
171 if($j(this).prevAll('input:hidden').length){
172 var parent_id = $j(this).prevAll('input:hidden').eq(0).val();
173 }else{
174 var parent_id = $j(this).prevAll().children('input:hidden').eq(0).val();
175 }
176
177 /* handle radio lookups */
178 if($j(this).prevAll('[type=radio]').length){
179 parent_id = $j(this).prevAll('[type=radio]').eq(0).val();
180 }
181
182 if(parent_id != '{empty_value}' && parent_id != undefined && parent_id != ''){
183 var parent_link = $j(this).parents('.form-group').children('label').data('parent_link');
184 switch(parent_link){
185 case 'view_parent_hidden':
186 break;
187 case 'view_parent_modal':
188 modal_window({
189 url: pt + '_view.php?Embedded=1&SelectedID=' + encodeURIComponent(parent_id),
190 close: function(){
191 var field_id = $j('#' + pt + '_view_parent').prevAll('input:hidden').eq(0).attr('id');
192 $j('#' + field_id + '-container').select2('focus').select2('focus');
193 },
194 size: 'full',
195 title: $j(this).attr('title')
196 });
197 break;
198 case 'view_parent_same_window':
199 window.location = pt + '_view.php?Embedded=' + (embedded_mode ? '1' : '') + '&SelectedID=' + encodeURIComponent(parent_id);
200 break;
201 case 'view_parent_new_window':
202 window.open(pt + '_view.php?SelectedID=' + encodeURIComponent(parent_id));
203 break;
204 }
205
206 }
207 });
208
209
210 /* load admin tools for admin user */
211 if(!add_new_mode){
212 $j('body').append('<div id="admin-tools-appendix"></div>');
213 $j('#admin-tools-appendix').load(
214 'ajax_admin_tools.php?table=departments&id=<%%URLVALUE(id)%%>',
215 function(resp){
216 if(!resp.length) return;
217 $j.ajax('ajax_admin_tools.php?action=get_admin_tools_js&table=departments&id=<%%URLVALUE(id)%%>');
218 }
219 );
220 }
221
222 /* warn user if 'add new' clicked while unsaved changes exist */
223 $j('#addNew').click(function(){
224 if($j('#deselect.btn-warning').length){
225 return confirm('<%%TRANSLATION(discard changes confirm)%%>');
226 }
227 });
228
229 });
230 </script>
2
3 <a name="detail-view"></a>
4 <div class="panel-heading"><h3 class="panel-title"><strong><%%DETAIL_VIEW_TITLE%%></strong></h3></div>
5
6 <div class="panel-body" id="departments_dv_container">
7 <!-- child links -->
8 <div class="row vspacer-md">
9 <div class="col-xs-12">
10 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="class_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="class_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Class time table</a>
11 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="class_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_class_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Class time table</a>
12 <input type="hidden" id="class_time_table_hclink" value="class_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
13 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="exam_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="exam_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Exam time table</a>
14 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="exam_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_exam_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Exam time table</a>
15 <input type="hidden" id="exam_time_table_hclink" value="exam_time_table_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
16 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="student_details_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="student_details_link"><i class="glyphicon glyphicon-list-alt"></i> Student details</a>
17 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="student_details_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_student_details_link"><i class="glyphicon glyphicon-list-alt"></i> Student details</a>
18 <input type="hidden" id="student_details_hclink" value="student_details_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
19 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="notices_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="notices_link"><i class="glyphicon glyphicon-list-alt"></i> Notices</a>
20 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="notices_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_notices_link"><i class="glyphicon glyphicon-list-alt"></i> Notices</a>
21 <input type="hidden" id="notices_hclink" value="notices_view.php?filterer_department=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
22 <div class="clearfix"></div>
23 </div>
24 </div>
25 <hr class="hidden-xs hidden-sm">
26
27 <div class="row">
28 <!-- form inputs -->
29 <div class="col-md-8 col-lg-10" id="departments_dv_form">
30 <fieldset class="form-horizontal">
31
32 <div class="form-group">
33 <hr class="hidden-md hidden-lg">
34 <label for="id" class="control-label col-lg-3">ID</label>
35 <div class="col-lg-9">
36 <div class="form-control-static" id="id"><%%VALUE(id)%%></div>
37 </div>
38 </div>
39
40 <div class="form-group">
41 <hr class="hidden-md hidden-lg">
42 <label for="name" class="control-label col-lg-3">Tên Môn học<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
43 <div class="col-lg-9">
44 <input maxlength="40" type="text" class="form-control" name="name" id="name" value="<%%VALUE(name)%%>" required>
45 </div>
46 </div>
47
48 <div class="form-group">
49 <hr class="hidden-md hidden-lg">
50 <label for="school" class="control-label col-lg-3" data-parent_link="view_parent_modal">Lớp học<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
51 <div class="col-lg-9">
52 <div class="form-control-static" style="white-space: nowrap; overflow-x: hidden;"><%%COMBO(school)%%><%%PLINK(school)%%><%%ADDNEW(schools)%%></div>
53 </div>
54 </div>
55
56 </fieldset>
57 </div>
58
59 <!-- DV action buttons -->
60 <hr class="hidden-md hidden-lg">
61 <div class="col-md-4 col-lg-2" id="departments_dv_action_buttons">
62 <div class="btn-toolbar">
63 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
64 <%%UPDATE_BUTTON%%>
65 </div><p></p>
66 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
67 <%%DESELECT_BUTTON%%>
68 <%%DVPRINT_BUTTON%%>
69 <%%DELETE_BUTTON%%>
70 </div><p></p>
71 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
72 <%%INSERT_BUTTON%%>
73 </div>
74 </div>
75 </div>
76 </div>
77
78
79 <!-- child records -->
80 <hr>
81 <div class="row">
82 <div class="col-lg-10 col-lg-offset-1">
83 <div id="departments-children" class="children-tabs"></div>
84 </div>
85 </div>
86
87 </div><!-- /div class="panel-body" -->
88 <script>
89 $j(function() {
90 var add_new_mode = (!$j('input[name=SelectedID]').val());
91 var embedded_mode = ($j('input[name=Embedded]').val() == 1);
92
93 /* auto-close embedded page? */
94 var autoclose_mode = ($j('input[name=AutoClose]').val() == 1);
95 var record_added_ok = (location.search.split('record-added-ok=').length == 2);
96 var record_updated_ok = (location.search.split('record-updated-ok=').length == 2);
97 if((record_added_ok || record_updated_ok) && embedded_mode && autoclose_mode){
98 setTimeout(AppGini.closeParentModal, 2000);
99 }
100
101 /* enable DV action buttons to float on scrolling down the form */
102 enable_dvab_floating();
103
104 if(!(embedded_mode && AppGini.mobileDevice())){
105 $j('select, input[type=text], textarea').not(':disabled').eq(0).focus();
106 }
107
108 $j('form').eq(0).change(function(){
109 if($j(this).data('already_changed')) return;
110 if($j('#deselect').length) $j('#deselect').removeClass('btn-default').addClass('btn-warning').get(0).lastChild.data = " <%%TRANSLATION(Cancel)%%>";
111 $j(this).data('already_changed', true);
112 });
113
114 $j('a[href="<%%TRANSLATION(ImageFolder)%%>"]').click(function(){ /* */ return false; });
115
116 if(embedded_mode){
117 /* hide links to children tables in embedded mode */
118 $j('.detail_view a[id$=_link]').remove();
119
120 /* append embedded mode to all links */
121 var append_embedded = function(){
122 $j('a[href]:not([href^="#"]):not([href^="javascript"]):not([href$="Embedded=1"]):not([href*="link.php?t="]):not([href^="mailto:"])').each(
123 function(){
124 $j(this).attr('href', $j(this).attr('href') + '&Embedded=1');
125 }
126 );
127 }
128 setTimeout(append_embedded, 500);
129 setTimeout(append_embedded, 1500);
130 setTimeout(append_embedded, 2500);
131 setTimeout(append_embedded, 3500);
132 }
133
134 /* when no record is selected ('add new' mode) */
135 if(add_new_mode){
136 /* hide links to children tables */
137 $j('.detail_view a[id$=_link]').remove();
138 }else{
139 post(
140 'parent-children.php', {
141 ParentTable: 'departments',
142 SelectedID: '<%%VALUE(id)%%>',
143 Operation: 'show-children'
144 },
145 'departments-children'
146 );
147 }
148
149 if(!embedded_mode){
150 /* add a horizontal spacer to [add new parent] buttons that don't have a spacered element before them */
151 $j('.add_new_parent').prev(':not(.hspacer-md)').next().addClass('hspacer-md');
152
153 $j('.add_new_parent').click(function(){
154 var pt = $j(this).attr('id').replace(/_add_new$/, '');
155 modal_window({
156 url: pt + '_view.php?addNew_x=1&Embedded=1',
157 close: function(){
158 var field_id = $j('#' + pt + '_add_new').prevAll('input:hidden').eq(0).attr('id');
159 $j('#' + field_id + '-container').select2('focus').select2('focus');
160 },
161 size: 'full',
162 title: $j(this).attr('title')
163 });
164 });
165 }
166
167 AppGini.hideViewParentLinks();
168
169 $j('form').on('click', '.view_parent', function(){
170 var pt = $j(this).attr('id').replace(/_view_parent$/, '');
171 if($j(this).prevAll('input:hidden').length){
172 var parent_id = $j(this).prevAll('input:hidden').eq(0).val();
173 }else{
174 var parent_id = $j(this).prevAll().children('input:hidden').eq(0).val();
175 }
176
177 /* handle radio lookups */
178 if($j(this).prevAll('[type=radio]').length){
179 parent_id = $j(this).prevAll('[type=radio]').eq(0).val();
180 }
181
182 if(parent_id != '{empty_value}' && parent_id != undefined && parent_id != ''){
183 var parent_link = $j(this).parents('.form-group').children('label').data('parent_link');
184 switch(parent_link){
185 case 'view_parent_hidden':
186 break;
187 case 'view_parent_modal':
188 modal_window({
189 url: pt + '_view.php?Embedded=1&SelectedID=' + encodeURIComponent(parent_id),
190 close: function(){
191 var field_id = $j('#' + pt + '_view_parent').prevAll('input:hidden').eq(0).attr('id');
192 $j('#' + field_id + '-container').select2('focus').select2('focus');
193 },
194 size: 'full',
195 title: $j(this).attr('title')
196 });
197 break;
198 case 'view_parent_same_window':
199 window.location = pt + '_view.php?Embedded=' + (embedded_mode ? '1' : '') + '&SelectedID=' + encodeURIComponent(parent_id);
200 break;
201 case 'view_parent_new_window':
202 window.open(pt + '_view.php?SelectedID=' + encodeURIComponent(parent_id));
203 break;
204 }
205
206 }
207 });
208
209
210 /* load admin tools for admin user */
211 if(!add_new_mode){
212 $j('body').append('<div id="admin-tools-appendix"></div>');
213 $j('#admin-tools-appendix').load(
214 'ajax_admin_tools.php?table=departments&id=<%%URLVALUE(id)%%>',
215 function(resp){
216 if(!resp.length) return;
217 $j.ajax('ajax_admin_tools.php?action=get_admin_tools_js&table=departments&id=<%%URLVALUE(id)%%>');
218 }
219 );
220 }
221
222 /* warn user if 'add new' clicked while unsaved changes exist */
223 $j('#addNew').click(function(){
224 if($j('#deselect.btn-warning').length){
225 return confirm('<%%TRANSLATION(discard changes confirm)%%>');
226 }
227 });
228
229 });
230 </script>